<div class="bjui-pageContent">
    <form action="/admin/administration/workflow/flow-config-process-edit" method="post" data-toggle="ajaxform"
          data-options="{closeCurrent:true, okAfterCallback:refreshFlowConfig}">
        <div class="bjui-row col-3">
            <input type="hidden" name="id" value="{{$id}}">
            <label class="row-label" style="width: 150px">步骤名称</label>
            <div class="row-input required" style="width:240px">
                <input type="text" name="description" data-rule="required" value="{{$description}}">
            </div>
            <br/>
            <label class="row-label" style="width: 150px">选择人员</label>
            <div class="row-input required" style="width:240px">
                @include('admin.widgets.address-list', ['findgrid_contacts_id' => 'operator_id', 'findgrid_address_list_name_value' => $operator_name, 'findgrid_contacts_id_value' => $operator_id])
            </div>
            <br>

            <label class="row-label" style="width: 150px">按钮选择</label>
            <div class="row-input required" style="width:240px">
                @foreach($buttonArr as $buttonKey => $buttonTitle)
                    <input type="radio" name="button_value" data-rule="required" value="{{$buttonKey}}"  @if($buttonKey == $defaultButtonValue) checked="true"  @endif>{{$buttonTitle}}<br>
                @endforeach
            </div>
            <br/>

        </div>
    </form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li>
            <button type="button" class="btn-close" data-icon="close">取消</button>
        </li>
        <li>
            <button type="submit" class="btn-default" data-icon="save">保存</button>
        </li>
        <li>
            <button type="button" class="btn-default" data-icon="remove" onclick="deleteFlowConfig()">删除</button>
        </li>
    </ul>
</div>
<script>
    function refreshFlowConfig() {
        BJUI.navtab('refresh', 'flow-config');
    }
    function deleteFlowConfig() {
        BJUI.alertmsg('confirm', '你确定要删除当前步骤吗？', {
            okCall: function() {
                BJUI.ajax('doajax', {
                    data:{
                        id:{{$id}}
                    },
                    url: '/admin/administration/workflow/flow-config-process-delete',
                    loadingmask: true,
                    okCallback: function(json, options) {
                        if(json.statusCode == 200) {
                            BJUI.alertmsg('ok', json.message);
                            BJUI.dialog('closeCurrent');
                            BJUI.navtab('refresh', 'flow-config');
                        } else {
                            BJUI.alertmsg('error', json.message);
                            BJUI.dialog('closeCurrent');
                        }
                    }
                })
            }
        });
    }
</script>
